package com.wpl.service.impl;

import com.wpl.bean.Customer;
import com.wpl.dao.CustomerMapper;
import com.wpl.service.ICustomerService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 客户
 */
@Service
public class CustomerServiceImpl implements ICustomerService {

    @Resource
    private CustomerMapper customerMapper;

    /**
     * 客户列表
     * @return
     */
    @Override
    public List<Customer> findAll() {
        return customerMapper.selectByExample(null);
    }

    /**
     * 添加客户
     * @param customer
     * @return
     */
    @Override
    public int addCustomer(Customer customer) {
        return customerMapper.insert(customer);
    }

    /**
     *  根据ID查询客户信息
     * @param id
     * @return
     */
    @Override
    public Customer findById(Integer id) {
        return customerMapper.selectByPrimaryKey(id);
    }
}
